package com.demo.search.dao.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.demo.search.dao.SearchTaskDao;
import com.demo.search.model.SearchTask;
import com.demo.search.model.SearchTask.Status;

/**
 * 索引任务数据访问实现类
 * @author ryuu.kk
 *
 */
public class SearchTaskDaoImpl extends SqlMapClientDaoSupport implements SearchTaskDao {

	@SuppressWarnings("unchecked")
	@Override
	public List<SearchTask> select(Map<String, Object> params) {
		return getSqlMapClientTemplate().queryForList("searchTaskSpace.select", params);
	}

	@Override
	public void update(Long id, Status status) {
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("id", id);
		params.put("status", status.get());
		getSqlMapClientTemplate().update("searchTaskSpace.update", params);
	}
}
